//引入Vue核心库
import Vue from 'vue'
//引入Vuex
import Vuex from 'vuex'
//应用Vuex插件
Vue.use(Vuex)


//准备mutations对象——修改state中的数据
const mutations = {
    getRole(state, value){
        state.role = value;
    },
    getId(state, value){
        state.id = value
    },
    getName(state, value){
        state.nickname = value
    },
    getAvatar(state, value){
        state.avatar = value
    }
}
//准备state对象——保存具体的数据
const state = {role:0, id:0, nickname:'', avatar:''}

//创建并暴露store
export default new Vuex.Store({
    mutations,
    state
})